package com.example.link.mapper;

import com.example.link.entity.LinkGroup;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author qwert
 * @version 1.0.0
 * @create 2025/8/17 20:12
 **/
@Mapper
public interface LinkGroupMapper {

    @Select("""
select * from link_group where user_id = #{userId};
""")
    List<LinkGroup> queryLinkGroupByUserId(String userId);

    @Insert("""
INSERT INTO link_group (group_id, user_id, name, description, create_time, update_time, operator_id, is_delete)
VALUES (#{groupId}, #{userId}, #{name}, #{description}, now(), now(), null, 0);
""")
    void createLinkGroup(LinkGroup linkGroup);

    @Select("""
select * from link_group where name like #{name};
""")
    LinkGroup queryLinkGroupByName(String name);
}
